#define _CRT_SECURE_NO_WARNINGS_1
//1111111111111111
#include<iostream>
using namespace std;
#include<string>
//class Calculator
//{
//public:
//	int getResult(string a)
//	{
//		if (a =="+")
//			return m_num1 + m_num2;
//		if (a == "-")
//			return m_num1 - m_num2;
//		if (a == "*")
//			return m_num1 * m_num2;
//		if (a == "/")
//			return m_num1 / m_num2;
//	}
//	int m_num1;
//	int m_num2;
//};
//void test()
//{
//	Calculator c;
//	c.m_num1 = 10;
//	c.m_num2 = 10;
//	cout << "num1+num2=" << c.getResult("+") << endl;
//	cout << "num1-num2=" << c.getResult("-") << endl;
//	cout << "num1*num2=" << c.getResult("*") << endl;
//    cout << "num1/num2=" << c.getResult("/") << endl;
//}
//int main()
//{
//	test();
//	return 0;
//}

//ʵ�ּ������ĳ�����
class AbstractCalculator
{
public:
	virtual int getResult()
	{
		return 0;
	}
	int m_num1;
	int m_num2;
};
//�ӷ���������
class AddCalculator :public AbstractCalculator
{
public:
    int getResult()
	{
		return m_num1 + m_num2;
	}
};
class SubCalculator :public AbstractCalculator
{
public:
	int getResult()
	{
		return m_num1 - m_num2;
	}
};
class MulCalculator :public AbstractCalculator
{
public:
	int getResult()
	{
		return m_num1 * m_num2;
	}
};
void test()
{   //����ָ�������ָ������
	//�ӷ�����
	AbstractCalculator *abc = new AddCalculator;
	abc->m_num1 =10;
	abc->m_num2 =10;
	cout << abc->m_num1 << " + " << abc->m_num2 << " = " << abc->getResult() << endl;
	delete abc;
	//��������
	abc = new SubCalculator;
    abc->m_num1 = 10;
	abc->m_num2 = 10;
	cout << abc->m_num1 << " - " << abc->m_num2 << " = " << abc->getResult() << endl;
	delete abc;
	//�˷�����
	abc = new MulCalculator;
	abc->m_num1 = 10;
	abc->m_num2 = 10;
	cout << abc->m_num1 << " * " << abc->m_num2 << " = " << abc->getResult() << endl;
	delete abc;
}
int main()
{
	test();
	return 0;
}

